package com.example.task1.ui.AllService.subway;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.example.task1.R;
import com.example.task1.bean.SubwayRideRecodeBean;
import com.example.task1.ui.BaseAdapter;

import java.util.ArrayList;
import java.util.List;

public class SubwayRideRecodeAdapter extends BaseAdapter<SubwayRideRecodeBean.RowsDTO> {

    private Context context;
    private List<SubwayRideRecodeBean.RowsDTO> mData = new ArrayList<>();
    private TextView tvName;
    private TextView tvStart;
    private TextView tvStop;
    private TextView tvOnTime;
    private TextView tvOffTime;

    public SubwayRideRecodeAdapter(Context context) {
        this.context = context;
    }

    @Override
    protected void setData(List<SubwayRideRecodeBean.RowsDTO> rows) {
        mData = rows;
        notifyDataSetChanged();
    }

    @Override
    protected int getLayout() {
        return R.layout.subwayriderecodelist;
    }

    @Override
    protected Context getContext() {
        return null;
    }

    @Override
    protected List<SubwayRideRecodeBean.RowsDTO> getData() {
        return null;
    }

    @Override
    protected void onBind(myHolder holder, SubwayRideRecodeBean.RowsDTO date) {
        tvName.setText("乘车人：" + date.getUserName());
        tvOffTime.setText("下车时间：" + date.getOffTime());
        tvOnTime.setText("上车时间：" + date.getOnTime());
        tvStart.setText("上车地点：" + date.getStart());
        tvStop.setText("下车地点：" + date.getStop());
    }

    @Override
    protected void holder(View view) {
        initView(view);
    }

    private void initView(View view) {
        tvName = view.findViewById(R.id.tv_name);
        tvStart = view.findViewById(R.id.tv_start);
        tvStop = view.findViewById(R.id.tv_stop);
        tvOnTime = view.findViewById(R.id.tv_onTime);
        tvOffTime = view.findViewById(R.id.tv_offTime);
    }
}
